package com.altekis.kanbankaze.client;

import java.util.Date;
import java.util.List;

import com.altekis.kanbankaze.server.TaskServiceImpl;
import com.altekis.kanbankaze.shared.SerializableWhiteList;
import com.altekis.kanbankaze.shared.Task;
import com.altekis.kanbankaze.shared.UserStory;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.google.inject.ImplementedBy;

/**
 * The client side stub for the {@link Task} RPC service.
 * 
 * @author gabriprat
 */
@RemoteServiceRelativePath("GWT.rpc")
@ImplementedBy(TaskServiceImpl.class)
public interface TaskService extends RemoteService {
	
	/**
	   * Utility/Convenience class. Use TaskService.App.getInstance() to access
	   * static instance of TaskServiceAsync
	   */
	  public static class App {
	    private static final TaskServiceAsync ourInstance = (TaskServiceAsync) GWT.create(TaskService.class);

	    public static TaskServiceAsync getInstance() {
	      return ourInstance;
	    }
	  }

	/**
	 * Saves the given task
	 * 
	 * @param task
	 *            The task to save
	 * @return the saved task
	 */
	Task save(Task task);

	/**
	 * Gets all the Tasks
	 * 
	 * @return All the tasks in the data store
	 */
	List<Task> findAll();
	
	/**
	 * Gets all the User Stories
	 * 
	 * @return All the user stories in the data store
	 */
	List<UserStory> findAllUserStories();
	
	/**
	 * Gets all the Tasks with {@link Task#getModificationDate()} greater than
	 * the given date.
	 * 
	 * @param minDate
	 *            The minimum modification date
	 * @return The {@link Task}s matching the criteria
	 */
	List<Task> findNewer(Date minDate);
	
	/**
	 * Fake method to force classes serialization 
	 *
	 */
	SerializableWhiteList fakeMethod(SerializableWhiteList l);
}
